/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.unmsm.pacis.shca.domain.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;

/**
 *
 * @author solriver
 */
@Entity
@Table(name = "tenencia_animal", catalog = "bdshca")
@NamedQueries({
    @NamedQuery(name = "TenenciaAnimal.findAll", query = "SELECT t FROM TenenciaAnimal t"),
    @NamedQuery(name = "TenenciaAnimal.findByIdTenenciaAnimal", query = "SELECT t FROM TenenciaAnimal t WHERE t.idTenenciaAnimal = :idTenenciaAnimal"),
    @NamedQuery(name = "TenenciaAnimal.findByTenTenencia", query = "SELECT t FROM TenenciaAnimal t WHERE t.tenTenencia = :tenTenencia"),
    @NamedQuery(name = "TenenciaAnimal.findByTenVacuna", query = "SELECT t FROM TenenciaAnimal t WHERE t.tenVacuna = :tenVacuna"),
    @NamedQuery(name = "TenenciaAnimal.findByTenTipo", query = "SELECT t FROM TenenciaAnimal t WHERE t.tenTipo = :tenTipo")})
public class AnimalPossession implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id_tenencia_animal")
    private Integer id;
    @Column(name = "ten_tenencia")
    private Boolean possession;
    @Column(name = "ten_vacuna")
    private Boolean vaccine;
    @Column(name = "ten_tipo")
    private Short type;
    @JoinColumn(name = "ani_id_animal", referencedColumnName = "id_animal")
    @ManyToOne(optional = false)
    private Animal animal;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "animalPossession")
    private List<HomeVisit> homeVisits;

    public AnimalPossession() {
    }

    public AnimalPossession(Integer idTenenciaAnimal) {
        this.id = idTenenciaAnimal;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Boolean getPossession() {
        return possession;
    }

    public void setPossession(Boolean possession) {
        this.possession = possession;
    }

    public Boolean getVaccine() {
        return vaccine;
    }

    public void setVaccine(Boolean vaccine) {
        this.vaccine = vaccine;
    }

    public Short getType() {
        return type;
    }

    public void setType(Short type) {
        this.type = type;
    }

    public Animal getAnimal() {
        return animal;
    }

    public void setAnimal(Animal animal) {
        this.animal = animal;
    }

    public List<HomeVisit> getHomeVisits() {
        return homeVisits;
    }

    public void setHomeVisits(List<HomeVisit> homeVisits) {
        this.homeVisits = homeVisits;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof AnimalPossession)) {
            return false;
        }
        AnimalPossession other = (AnimalPossession) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pe.edu.unmsm.pacis.shca.domain.entity.AnimalPossession[ id=" + id + " ]";
    }
    
}
